home *** CD-ROM | disk | FTP | other *** search
/ Animations / Animations CD - Disc 2.iso / mainactor / rexx / dither_adpro.ma < prev    next >
Text File  |  1994-04-10  |  3KB  |  139 lines

  1. /*
  2.  *
  3.  *     Dither V 1.1, 1993 Markus Moenig
  4.  *
  5.  *     Dithers the source project to a requested amount of colours, needs AdPro !!
  6.  *     The new project will also be in the format of the selected save module.
  7.  *
  8.  *     The loader/saver of the source project can be either picture
  9.  *     or animation modules.
  10.  *
  11.  *     A new project will be opened for the resulting pictures/animation.
  12.  */
  13.  
  14. OPTIONS RESULTS
  15.  
  16. ADDRESS MAINACTOR 
  17.  
  18. ScreenToFront
  19. PrintAndStoreTXT "Dither V1.1, dithering project ..."
  20.  
  21. IF ~SHOW('P','ADPro') THEN DO  /* if not allready running, start adpro */
  22.     ADDRESS MAINACTOR PrintTXT "Invoking AdPro ..."
  23.     ADDRESS COMMAND 'run >NIL: <NIL: adpro:adpro BEHIND MAXMEM=1000000'
  24.     ADDRESS COMMAND Wait 5
  25. END  
  26.  
  27. ADDRESS MAINACTOR
  28.  
  29. GetSPName
  30.  
  31. IF rc = 0 THEN DO                          /* check if project loaded */
  32.  
  33.     PARSE VAR RESULT firstname secondname .  /* store name of the animation */
  34.                                              /* or the names of the picture list */
  35.     ScreenToFront
  36.  
  37.     DeSelectAll
  38.  
  39.     GetSPSaver
  40.     PARSE VAR RESULT savertype savername .   /* store type, name of saver module */
  41.  
  42.                                            /* Store general infos of the project */
  43.     GetSPInfo
  44.     PARSE VAR RESULT width height colors pics caching loop cpf .
  45.  
  46.     colors=16
  47.  
  48.     RequestInteger colors "Enter amount of Colours (0=HAM, 1=HAM8)"
  49.     IF RC = 10 THEN DO
  50.         PrintTXT "Aborting ..."
  51.         EXIT
  52.     END
  53.     NewColors=RESULT
  54.     IF NewColors = 0 THEN NewColors="HAM"
  55.     IF NewColors = 1 THEN NewColors="HAM8"
  56.     
  57.     IF savertype = "PIC" THEN
  58.         picformat=savername
  59.     ELSE DO
  60.         picformat=IFF
  61.         SetSPSaver PIC picformat
  62.     END
  63.     
  64.     ADDRESS "ADPro"
  65.         LFormat "Universal"
  66.         PSTATUS UNLOCKED
  67.         ORIENTATION PORTRAIT
  68.         SFormat picformat
  69.  
  70.     ADDRESS MAINACTOR
  71.  
  72.     RequestSaveFile "Select Name of Project" /* Ask for Project Name */
  73.  
  74.     IF RC = 10 THEN DO
  75.         PrintTXT "Aborting ..."
  76.         EXIT
  77.     END
  78.  
  79.     newname = RESULT                         /* new name = RESULT */
  80.  
  81.     SelectAll
  82.     
  83.     saveargs=newname
  84.         
  85.     Save saveargs                            /* Save Pictures */
  86.  
  87.     DO i=1 to pics                           /* Scale all pics */
  88.  
  89.         actualpic=newname || "." || Right("00000" || i, 5)
  90.     PrintTxt "ADPro dithers Picture" i
  91.  
  92.         ADDRESS "ADPro"    
  93.         Load actualpic
  94.         RENDER_TYPE NewColors
  95.         PSORT 0
  96.         Execute    
  97.         Save actualpic IMAGE
  98.  
  99.         ADDRESS MAINACTOR
  100.  
  101.     END
  102.  
  103.     IF caching = "CACHING=YES" THEN                 /* Was the old project cached ? */
  104.         
  105.         OpenNewProject "CACHING"               /* If yes new project is also cached */
  106.     
  107.     ELSE 
  108.         
  109.         OpenNewProject                         /* If not new project is not cached */
  110.  
  111.     SetSPLoader PIC picformat                /* Set the new projects loader module */
  112.  
  113.     firstpic=newname || "." || Right("00000" || 1, 5)
  114.     lastpic=newname || "." || Right("00000" || pics, 5)
  115.  
  116.     LoadProject firstpic lastpic             /* Load picture list */
  117.  
  118.     SetSPSaver savertype savername
  119.  
  120.     IF savertype = "ANIM" THEN DO            /* If we wanted a new animation, */
  121.                                              /* we have to build it */
  122.         SelectAll
  123.         saveargs=newname || " " || cpf || " " || loop
  124.         Save saveargs
  125.         UnloadProject
  126.         
  127.         DO i=1 TO pics                         /* delete temporary pics */
  128.             actualpic=newname || "." || Right("00000" || i, 5)
  129.             PrintTxt "Delete " || actualpic
  130.             ADDRESS COMMAND    "delete " || actualpic || "#?"
  131.         END
  132.         
  133.         SetSPLoader savertype savername
  134.         LoadProject newname
  135.     END
  136.     
  137.     PrintAndStoreTXT "READY !!!!"
  138. END
  139.